<template>
    <div>
        <a-modal
            :title="modalTitle"
            :visible="visible"
            :maskClosable="false"
            :closable="true"
            :destroyOnClose="true"
            width="900px"
            :dialog-style="{ margin: '0 auto' }"
            wrapClassName="budgetDeclaration-toExamine-modal"
            @cancel="closeVisible">
            <div style="width: 794px;margin: 0 auto">
                <div id="budgetDeclaration-totalPrint">
                    <div>
                        <!-- 审评 -->
                        <div v-if="yuSuanList.jcList.length" class="budgetDeclaration-yuSuanList">
                            <h1 style="text-align: center;">审评</h1>
                            <table border="1" cellspacing="0" class="table-Lu" style="width: 100%;">
                                <tr>
                                    <th colspan="2" rowspan="3">科室</th>
                                    <th rowspan="3">项目</th>
                                    <th colspan="9">差旅费</th>
                                    <th colspan="4" rowspan="2">劳务费</th>
                                </tr>
                                <tr>
                                    <th colspan="4">差旅补助</th>
                                    <th colspan="2">住宿费</th>
                                    <th colspan="2">交通费</th>
                                    <th rowspan="2">合计</th>
                                </tr>
                                <tr>
                                    <th>企业数/组数</th>
                                    <th>人数</th>
                                    <th>天数</th>
                                    <th>小计</th>
                                    <th>住宿天数</th>
                                    <th>小计</th>
                                    <th>交通天数</th>
                                    <th>小计</th>
                                    <th>审评天数</th>
                                    <th>人次</th>
                                    <th>标准</th>
                                    <th>小计</th>
                                </tr>
                                <template v-for="(item,index) in yuSuanList.jcList">
                                    <template v-if="item.list[0] && item.list[0].name">
                                        <template v-for="(itema,indexa) in item.list">
                                            <tr v-for="(itemc,indexc) in itema.list">
                                                <th :rowspan="totalListLength(item.list) + 3" v-if="indexa == 0 && indexc == 0">{{ item.name }}</th>
                                                <th :rowspan="itema.list.length" v-if="indexc == 0">{{ itema.name }}</th>
                                                <td>{{ itemc.fxmmc }}</td>
                                                <td>{{ itemc.fclbzqyszs }}</td>
                                                <td>{{ itemc.fclbzrs }}</td>
                                                <td>{{ itemc.fclbzts }}</td>
                                                <td>{{ itemc.fclbzxj }}</td>
                                                <td>{{ itemc.fzxfts }}</td>
                                                <td>{{ itemc.fzxfxj }}</td>
                                                <td>{{ itemc.fjtfts }}</td>
                                                <td>{{ itemc.fjtfxj }}</td>
                                                <td>{{ itemc.fclfhjh }}</td>
                                                <td>{{ itemc.flwfjcts }}</td>
                                                <td>{{ itemc.flwfrc }}</td>
                                                <td>{{ itemc.flwfbz }}</td>
                                                <td>{{ itemc.flwfxj }}</td>
                                            </tr>
                                            <tr>
                                                <th colspan="2">小计</th>
                                                <td>{{ getAmountData('审评',item.name,'qys',itema.name) }}</td>
                                                <td>{{ getAmountData('审评',item.name,'clrs',itema.name) }}</td>
                                                <td>{{ getAmountData('审评',item.name,'clts',itema.name) }}</td>
                                                <td></td>
                                                <td>{{ getAmountData('审评',item.name,'zsts',itema.name) }}</td>
                                                <td></td>
                                                <td>{{ getAmountData('审评',item.name,'jtts',itema.name) }}</td>
                                                <td></td>
                                                <td>{{ getAmountData('审评',item.name,'clf',itema.name) }}</td>
                                                <td>{{ getAmountData('审评',item.name,'lwts',itema.name) }}</td>
                                                <td>{{ getAmountData('审评',item.name,'lwrc',itema.name) }}</td>
                                                <td></td>
                                                <td>{{ getAmountData('审评',item.name,'lwf',itema.name) }}</td>
                                            </tr>
                                        </template>
                                        <tr class="tr-hj">
                                            <th colspan="10">合计</th>
                                            <td>{{ getAmountData('审评',item.name,'clf') }}</td>
                                            <th colspan="3">合计</th>
                                            <td>{{ getAmountData('审评',item.name,'lwf') }}</td>
                                        </tr>
                                    </template>
                                    <template v-if="item.list[0] && !item.list[0].name && item.list[0].id">
                                        <tr v-for="(itemb,indexb) in item.list">
                                            <th :rowspan="item.list.length + 1" colspan="2" :key="'indexb' + indexb" v-if="indexb == 0">{{ item.name }}</th>
                                            <td>{{ itemb.fxmmc }}</td>
                                            <td>{{ itemb.fclbzqyszs }}</td>
                                            <td>{{ itemb.fclbzrs }}</td>
                                            <td>{{ itemb.fclbzts }}</td>
                                            <td>{{ itemb.fclbzxj }}</td>
                                            <td>{{ itemb.fzxfts }}</td>
                                            <td>{{ itemb.fzxfxj }}</td>
                                            <td>{{ itemb.fjtfts }}</td>
                                            <td>{{ itemb.fjtfxj }}</td>
                                            <td>{{ itemb.fclfhjh }}</td>
                                            <td>{{ itemb.flwfjcts }}</td>
                                            <td>{{ itemb.flwfrc }}</td>
                                            <td>{{ itemb.flwfbz }}</td>
                                            <td>{{ itemb.flwfxj }}</td>
                                        </tr>
                                        <tr class="tr-hj">
                                            <th>合计</th>
                                            <td>{{ getAmountData('审评',item.name,'qys') }}</td>
                                            <td>{{ getAmountData('审评',item.name,'clrs') }}</td>
                                            <td>{{ getAmountData('审评',item.name,'clts') }}</td>
                                            <td></td>
                                            <td>{{ getAmountData('审评',item.name,'zsts') }}</td>
                                            <td></td>
                                            <td>{{ getAmountData('审评',item.name,'jtts') }}</td>
                                            <td></td>
                                            <td>{{ getAmountData('审评',item.name,'clf') }}</td>
                                            <td>{{ getAmountData('审评',item.name,'lwts') }}</td>
                                            <td>{{ getAmountData('审评',item.name,'lwrc') }}</td>
                                            <td></td>
                                            <td>{{ getAmountData('审评',item.name,'lwf') }}</td>
                                        </tr>
                                    </template>
                                </template>
                                <tr class="tr-zj">
                                    <th colspan="11">总计</th>
                                    <td>{{ getAmountData('审评','总计','clf') }}</td>
                                    <th colspan="3">总计</th>
                                    <td>{{ getAmountData('审评','总计','lwf') }}</td>
                                </tr>
                            </table>
                        </div>
                        <!-- 课题 -->
                        <div v-if="yuSuanList.ktList.length" class="budgetDeclaration-yuSuanList">
                            <div v-if="!onlyPrint" style="page-break-after:always"></div>
                            <h1 style="text-align: center;">课题</h1>
                            <table border="1" cellspacing="0" class="table-Lu" style="width: 100%;">
                                <tr>
                                    <th>课题负责科室</th>
                                    <th>课题名称</th>
                                    <th>课题经费</th>
                                    <th>课题负责人</th>
                                    <th>课题委托单位/公司</th>
                                </tr>
                                <template v-for="(item,index) in yuSuanList.ktList" v-if="item.list.length">
                                    <tr v-for="(itemb,indexb) in item.list" :key="'kt'+index+indexb">
                                        <th :rowspan="item.list.length + 1" v-if="indexb == 0">{{ item.name }}</th>
                                        <td>{{ itemb.fktmc }}</td>
                                        <td>{{ itemb.fktjf }}</td>
                                        <td>{{ itemb.fktfzr }}</td>
                                        <td>{{ itemb.fktwtdw }}</td>
                                    </tr>
                                    <tr class="tr-hj">
                                        <th>合计</th>
                                        <td>{{ getAmountData('课题',item.name,'ktjf') }}</td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                </template>
                                <tr class="tr-zj">
                                    <th colspan="2">总计</th>
                                    <td>{{ getAmountData('课题','总计','ktjf') }}</td>
                                    <td></td>
                                    <td></td>
                                </tr>
                            </table>
                        </div>
                        <!-- 印刷 -->
                        <div v-if="yuSuanList.ysList.length" class="budgetDeclaration-yuSuanList">
                            <div v-if="!onlyPrint" style="page-break-after:always"></div>
                            <h1 style="text-align: center;">印刷</h1>
                            <table border="1" cellspacing="0" class="table-Lu" style="width: 100%;">
                                <tr>
                                    <th>科室</th>
                                    <th>印刷内容</th>
                                    <th>数量</th>
                                    <th>单价</th>
                                    <th>合计</th>
                                </tr>
                                <template v-for="(item,index) in yuSuanList.ysList" v-if="item.list.length">
                                    <tr v-for="(itemb,indexb) in item.list" :key="'ys'+index+indexb">
                                        <th :rowspan="item.list.length + 1" v-if="indexb == 0">{{ item.name }}</th>
                                        <td>{{ itemb.fsbmc }}</td>
                                        <td>{{ itemb.fsbsl }}</td>
                                        <td>{{ itemb.fmbqs }}</td>
                                        <td>{{ itemb.fyzhj }}</td>
                                    </tr>
                                    <tr class="tr-hj">
                                        <th colspan="3">合计</th>
                                        <td>{{ getAmountData('印刷',item.name,'ysf') }}</td>
                                    </tr>
                                </template>
                                <tr class="tr-zj">
                                    <th colspan="4">总计</th>
                                    <td>{{ getAmountData('印刷','总计','ysf') }}</td>
                                </tr>
                            </table>
                        </div>
                        <!-- 培训 -->
                        <div v-if="yuSuanList.pxList.length" class="budgetDeclaration-yuSuanList">
                            <div v-if="!onlyPrint" style="page-break-after:always"></div>
                            <h1 style="text-align: center;">培训</h1>
                            <table border="1" cellspacing="0" class="table-Lu" style="width: 100%;">
                                <tr>
                                    <th>科室</th>
                                    <th>培训班名称 </th>
                                    <th>培训内容 </th>
                                    <th>培训对象 </th>
                                    <th>培训地点 </th>
                                    <th>培训人数</th>
                                    <th>培训天数</th>
                                    <th>培训费用</th>
                                    <th>学时/天</th>
                                    <th>正高学时/天</th>
                                    <th>正高费用</th>
                                    <th>副高学时/天</th>
                                    <th>副高费用</th>
                                    <th>授课费</th>
                                    <th>小计</th>
                                </tr>
                                <template v-for="(item,index) in yuSuanList.pxList" v-if="item.list.length">
                                    <tr v-for="(itemb,indexb) in item.list" :key="'px'+index+indexb">
                                        <th :rowspan="item.list.length + 1" v-if="indexb == 0">{{ item.name }}</th>
                                        <td>{{ itemb.fpxmc }}</td>
                                        <td>{{ itemb.fpxnr }}</td>
                                        <td>{{ itemb.fpxdx }}</td>
                                        <td>{{ itemb.fpxdd }}</td>
                                        <!--  -->
                                        <td>{{ itemb.fpxrs }}</td>
                                        <td>{{ itemb.fpxts }}</td>
                                        <td>{{ itemb.fpxfy }}</td>
                                        <td>{{ itemb.fxst }}</td>
                                        <!--  -->
                                        <td>{{ itemb.fzgxs }}</td>
                                        <td>{{ itemb.fzgfy }}</td>
                                        <td>{{ itemb.ffgxs }}</td>
                                        <td>{{ itemb.ffgfy }}</td>
                                        <!--  -->
                                        <td>{{ itemb.fskf }}</td>
                                        <td>{{ itemb.fpxskxj }}</td>
                                    </tr>
                                    <tr class="tr-hj">
                                        <th colspan="4">合计</th>
                                        <td>{{ getAmountData('培训',item.name,'pxrs') }}</td>
                                        <td></td>
                                        <td>{{ getAmountData('培训',item.name,'pxf') }}</td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td>{{ getAmountData('培训',item.name,'szfy') }}</td>
                                        <td>{{ getAmountData('培训',item.name,'pxhj') }}</td>
                                    </tr>
                                </template>
                                <tr class="tr-zj">
                                    <th colspan="5">总计</th>
                                    <td>{{ getAmountData('培训','总计','pxrs') }}</td>
                                    <td></td>
                                    <td>{{ getAmountData('培训','总计','pxf') }}</td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td>{{ getAmountData('培训','总计','szfy') }}</td>
                                    <td>{{ getAmountData('培训','总计','pxhj') }}</td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div v-if="jiXiaoList.length" class="budgetDeclaration-yuSuanList">
                        <a-spin :spinning="false">
                            <div v-if="!onlyPrint" style="page-break-after:always"></div>
                            <h1 style="text-align: center;">预算申报绩效汇总表单</h1>
                            <table border="1" cellspacing="0" class="table-Lu color-Table-jiXiao" style="width: 100%;">
                                <tr>
                                    <th>科室</th>
                                    <th>绩效指标类型</th>
                                    <th>一级指标</th>
                                    <th>二级指标</th>
                                    <th>三级指标</th>
                                    <th>指标值</th>
                                </tr>
                                <tr v-if="jiXiaoList.length == 0">
                                    <td colspan="6">暂无数据</td>
                                </tr>
                                <template v-for="(itema,indexa) in jiXiaoList">
                                    <template v-for="(itemb,indexb) in itema.jxzbmcList">
                                        <template v-for="(itemc,indexc) in itemb.lxList">
                                            <template v-for="(itemd,indexd) in itemc.lxmcDataList">
                                                <template v-for="(itemf,indexf) in itemd.zbDataList">
                                                    <tr>
                                                        <!-- :rowspan="itema.size" v-if="indexc == 0 && indexd == 0 && indexf == 0" -->
                                                        <td class="td-itema" :rowspan="itema.size" v-if="(indexb == itema.index ) && indexc == 0 && indexd == 0 && indexf == 0">{{ itema.ksmc }}</td>
                                                        <td class="td-itemb" :rowspan="itemb.size" v-if="(indexc == itemb.index ) && indexd == 0 && indexf == 0">{{ itemb.fjssblx }}</td>
                                                        <td class="td-itemc1" :rowspan="itemc.size" v-if="indexd == 0 && indexf == 0">{{ itemc.lxmc }}</td>
                                                        <td class="td-itemd" :rowspan="itemd.zbDataList.length" v-if="indexf == 0">{{ itemd.slzb }}</td>
                                                        <td>{{ itemf.key }}</td>
                                                        <td>{{ itemf.value }}</td>
                                                    </tr>
                                                </template>
                                            </template>
                                        </template>
                                    </template>
                                </template>
                            </table>
                        </a-spin>
                    </div>
                    <div v-if="(yuSuanTableData.id) || (yuSuanTableData.lwf)" class="budgetDeclaration-yuSuanList">
                        <div v-if="!onlyPrint" style="page-break-after:always"></div>
                        <div v-if="isCaiWu">
                            <div style="width: 794px;margin: 0 auto;">
                                <h1 style="text-align: center;">2025年度预算审批表</h1>
                                <div class="text-style" style="display: flex;justify-content: space-between;padding: 0 30px;justify-content: end;">
                                    <span>单位：万元</span>
                                </div>
                                <table border="1" cellspacing="0" class="table-Lu">
                                    <tr>
                                        <th colspan="4">审评</th>
                                    </tr>
                                    <colgroup>
                                        <col style="width: 220px !important;" />
                                        <col />
                                        <col />
                                        <col />
                                    </colgroup>
                                    <tr>
                                        <th>劳务费</th>
                                        <td>{{ yuSuanTableData.lwf }}</td>
                                        <th>差旅费</th>
                                        <td>{{ yuSuanTableData.clf }}</td>
                                    </tr>
                                    <tr>
                                        <th colspan="4">课题</th>
                                    </tr>
                                    <tr>
                                        <th>课题数</th>
                                        <td>{{ yuSuanTableData.kts }}</td>
                                        <th>课题费</th>
                                        <td>{{ yuSuanTableData.ktjf }}</td>
                                    </tr>
                                    <tr>
                                        <th colspan="4">印刷</th>
                                    </tr>
                                    <tr>
                                        <th>印刷数</th>
                                        <td>{{ yuSuanTableData.fyss }}</td>
                                        <th>印刷费</th>
                                        <td>{{ yuSuanTableData.fysf }}</td>
                                    </tr>
                                    <tr>
                                        <th colspan="4">培训</th>
                                    </tr>
                                    <tr>
                                        <th>培训人数</th>
                                        <td>{{ yuSuanTableData.fpxrs }}</td>
                                        <th>培训费</th>
                                        <td>{{ yuSuanTableData.fpxf }}</td>
                                    </tr>
                                    <tr>
                                        <th>财务审核（一上）</th>
                                        <td colspan="3" class="td-fblyj">
                                            <div>
                                                <p class="text-align-left">{{ getYuSuanTableData('财务审核(一上)').fblyj }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="getYuSuanTableData('财务审核(一上)').fqm" :src="getYuSuanTableData('财务审核(一上)').fqm" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ getYuSuanTableData('财务审核(一上)').fblr }}</span>
                                                    <span>{{ getYuSuanTableData('财务审核(一上)').fblsj }}</span>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>办公室主任审核（一上）</th>
                                        <td colspan="3" class="td-fblyj">
                                            <div>
                                                <p class="text-align-left">{{ getYuSuanTableData('办公室领导审核(一上)').fblyj }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="getYuSuanTableData('办公室领导审核(一上)').fqm" :src="getYuSuanTableData('办公室领导审核(一上)').fqm" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ getYuSuanTableData('办公室领导审核(一上)').fblr }}</span>
                                                    <span>{{ getYuSuanTableData('办公室领导审核(一上)').fblsj }}</span>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>领导班子审核（一上）</th>
                                        <td colspan="3" class="td-fblyj">
                                            <div style="width: 100%;" v-for="(item,index) in formData.fysldbzshyj" :key="index">
                                                <p class="text-align-left">{{ formData.fysldbzshyj[index] }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="returnQmImg(formData.fysldbzshrid[index])" :src="returnQmImg(formData.fysldbzshrid[index])" alt="" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ formData.fysldbzshr[index] }}</span>
                                                    <span>{{ formData.fysldbzshyjsj[index] }}</span>
                                                </div>
                                            </div>
                                            <!-- <div>
                                                <p class="text-align-left">{{ getYuSuanTableData('领导班子审核(一上)').fblyj }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="getYuSuanTableData('领导班子审核(一上)').fqm" :src="getYuSuanTableData('领导班子审核(一上)').fqm" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ getYuSuanTableData('领导班子审核(一上)').fblr }}</span>
                                                    <span>{{ getYuSuanTableData('领导班子审核(一上)').fblsj }}</span>
                                                </div>
                                            </div> -->
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>财务审核（二上）</th>
                                        <td colspan="3" class="td-fblyj">
                                            <div>
                                                <p class="text-align-left">{{ getYuSuanTableData('财务审核(二上)').fblyj }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="getYuSuanTableData('财务审核(二上)').fqm" :src="getYuSuanTableData('财务审核(二上)').fqm" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ getYuSuanTableData('财务审核(二上)').fblr }}</span>
                                                    <span>{{ getYuSuanTableData('财务审核(二上)').fblsj }}</span>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>办公室主任审核（二上）</th>
                                        <td colspan="3" class="td-fblyj">
                                            <div>
                                                <p class="text-align-left">{{ getYuSuanTableData('办公室领导审核(二上)').fblyj }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="getYuSuanTableData('办公室领导审核(二上)').fqm" :src="getYuSuanTableData('办公室领导审核(二上)').fqm" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ getYuSuanTableData('办公室领导审核(二上)').fblr }}</span>
                                                    <span>{{ getYuSuanTableData('办公室领导审核(二上)').fblsj }}</span>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>领导班子审核（二上）</th>
                                        <td colspan="3" class="td-fblyj">
                                            <div style="width: 100%;" v-for="(item,index) in formData.fesldbzshyj" :key="index">
                                                <p class="text-align-left">{{ formData.fesldbzshyj[index] }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="returnQmImg(formData.fesldbzshrid[index])" :src="returnQmImg(formData.fesldbzshrid[index])" alt="" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ formData.fesldbzshr[index] }}</span>
                                                    <span>{{ formData.fesldbzshyjsj[index] }}</span>
                                                </div>
                                            </div>
                                            <!-- <div>
                                                <p class="text-align-left">{{ getYuSuanTableData('领导班子审核(二上)').fblyj }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="getYuSuanTableData('领导班子审核(二上)').fqm" :src="getYuSuanTableData('领导班子审核(二上)').fqm" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ getYuSuanTableData('领导班子审核(二上)').fblr }}</span>
                                                    <span>{{ getYuSuanTableData('领导班子审核(二上)').fblsj }}</span>
                                                </div>
                                            </div> -->
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <div v-else>
                            <div style="width: 794px;margin: 0 auto;">
                                <h1 style="text-align: center;">2025年部门预算项目申报表</h1>
                                <div class="text-style" style="display: flex;justify-content: space-between;padding: 0 30px;">
                                    <span>填报科室：{{ yuSuanTableData.fsqks }}</span>
                                    <span>单位：万元</span>
                                </div>
                                <table border="1" cellspacing="0" class="table-Lu">
                                    <tr>
                                        <th :rowspan="3">支出项目分类</th>
                                        <td colspan="2">
                                            差旅费：{{ yuSuanTableData.fzcxmflclf }} 万元
                                        </td>
                                        <td colspan="2">
                                            劳务费：{{ yuSuanTableData.fzcxmfllwf }} 万元
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            课题经费：{{ yuSuanTableData.fzcxmflktjf }} 万元
                                        </td>
                                        <td colspan="2">
                                            印刷费：{{ yuSuanTableData.fzcxmflysf }} 万元
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            培训费：{{ yuSuanTableData.fzcxmflpxf }} 万元
                                        </td>
                                        <td colspan="2">
                                            <span>其他（{{ yuSuanTableData.fzcxmflqtmc}}）：</span>
                                            {{ yuSuanTableData.fzcxmflqt }} 万元
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>项目金额</th>
                                        <td colspan="4">
                                            合计：{{ yuSuanTableData.xmje }} 万元
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>社会经济效益</th>
                                        <td colspan="4" class="text-left-style">{{ yuSuanTableData.shjjxy }}</td>
                                    </tr>
                                    <!-- <tr>
                                        <th>项目依据</th>
                                        <td colspan="4">{{ yuSuanTableData.xmyj }}</td>
                                    </tr>
                                    <tr>
                                        <th>项目内容<br>（详细测算过程）</th>
                                        <td colspan="4">{{ yuSuanTableData.xmnr }}</td>
                                    </tr> -->
                                    <colgroup>
                                        <col style="width:170px !important">
                                        <col>
                                        <col>
                                        <col>
                                        <col>
                                    </colgroup>
                                    <tr>
                                        <th>资金支出计划</th>
                                        <th>一季度</th>
                                        <th>二季度</th>
                                        <th>三季度</th>
                                        <th>四季度</th>
                                    </tr>
                                    <tr>
                                        <th>支出金额（差旅费）</th>
                                        <td>{{ yuSuanTableData.zjzcjhyjdclf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhejdclf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsjdclf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsijdclf }}</td>
                                    </tr>
                                    <tr>
                                        <th>支出金额（劳务费）</th>
                                        <td>{{ yuSuanTableData.zjzcjhyjdlwf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhejdlwf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsjdlwf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsijdlwf }}</td>
                                    </tr>
                                    <tr>
                                        <th>印刷费</th>
                                        <td>{{ yuSuanTableData.zjzcjhyjdysf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhejdysf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsjdysf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsijdysf }}</td>
                                    </tr>
                                    <tr>
                                        <th>培训费</th>
                                        <td>{{ yuSuanTableData.zjzcjhyjdpxf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhejdpxf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsjdpxf }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsijdpxf }}</td>
                                    </tr>
                                    <tr>
                                        <th>支出金额（根据支出项目分类填写）</th>
                                        <td>{{ yuSuanTableData.zjzcjhyjdzcje }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhejdzcje }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsjdzcje }}</td>
                                        <td>{{ yuSuanTableData.zjzcjhsijdzcje }}</td>
                                    </tr>
                                    <tr>
                                        <th>备注</th>
                                        <td colspan="4" class="text-left-style">{{ yuSuanTableData.bz }}</td>
                                    </tr>
                                    <tr>
                                        <th>科室负责人</th>
                                        <td colspan="4">
                                            <div>
                                                <p class="text-align-left">{{ yuSuanTableData.ksfzryj }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="yuSuanTableData.ksfzrqm" :src="yuSuanTableData.ksfzrqm" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ yuSuanTableData.ksfzrxm }}</span>
                                                    <span>{{ yuSuanTableData.ksfzrqmsj }}</span>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>分管领导人</th>
                                        <td colspan="4">
                                            <div>
                                                <p class="text-align-left">{{ yuSuanTableData.kfgldryj }}</p>
                                                <div class="yjqm-right-bottom">
                                                    <img v-if="yuSuanTableData.kfgldrqm" :src="yuSuanTableData.kfgldrqm" class="yjqmImg"/>
                                                    <span v-else class="yjqmImg">{{ yuSuanTableData.kfgldrxm }}</span>
                                                    <span>{{ yuSuanTableData.kfgldryjsj }}</span>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                                <!-- <div class="text-style" style="display: flex;justify-content: space-around;">
                                    <span>填报人：</span>
                                    <span>科室负责人：</span>
                                    <span>分管领导人：</span>
                                </div> -->
                                <p class="text-style">注：请各科室于8月 日前交办公室（财务）汇总。</p>
                            </div>
                        </div>
                    </div>
                    <div v-if="jiXiaoTableData" class="budgetDeclaration-yuSuanList">
                        <div v-for="(item,index) in jiXiaoTableData" :key="index" style="margin-top: 20px;">
                            <div v-if="!onlyPrint" style="page-break-after:always"></div>
                            <h1 style="text-align: center;">2025年项目支出绩效目标申报表</h1>
                            <table border="1" cellspacing="0" class="table-Lu">
                                <tr>
                                    <th>申报科室</th>
                                    <td>{{ item.fsbks }}</td>
                                    <th>支出项目</th>
                                    <td>{{ item.fzcxm }}</td>
                                </tr>
                                <tr>
                                    <th>项目实施单位</th>
                                    <td>{{ item.fxmssdw }}</td>
                                    <th>项目主管单位</th>
                                    <td>{{ item.fxmzgdw }}</td>
                                </tr>
                                <tr>
                                    <th>项目属性</th>
                                    <td colspan="3">{{ item.fxmsx }}</td>
                                </tr>
                                <tr>
                                    <th rowspan="2">资金总额</th>
                                    <th>资金来源</th>
                                    <th colspan="2">金额(万元)</th>
                                </tr>
                                <tr>
                                    <td>{{ item.fzjzezjly }}</td>
                                    <td colspan="2">{{ item.fzjzeje }}</td>
                                </tr>
                                <tr>
                                    <th>项目实施进度安排</th>
                                    <td colspan="3" class="text-left-style">{{ item.fxmssjdap }}</td>
                                </tr>
                                <tr>
                                    <th>总体绩效目标</th>
                                    <td colspan="3" class="text-left-style">{{ item.fztjxmb }}</td>
                                </tr>
                                <tr>
                                    <th>年度绩效目标</th>
                                    <td colspan="3" class="text-left-style">{{ item.fndjxmb }}</td>
                                </tr>
                                <tr>
                                    <th>中期绩效目标</th>
                                    <td colspan="3" class="text-left-style">{{ item.fzqjxmb }}</td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <template slot="footer">
                <a-button class="blue-btn" type="primary" v-print="printObj">打印</a-button>
            </template>
        </a-modal>
    </div>
</template>
<script>
import {
    getMoreUserSignLinkList,
} from './service/index'
export default {
    data() {
        return {
            printObj:{
                id:"budgetDeclaration-totalPrint", //需要打印的id名称
                popTitle:"预算申报打印",//文档的名称
                // preview:true,//预览功能，不好用
                zIndex:'20002',
                beforeOpenCallback(vue){
                    //console.log('打印回调',vue)
                },
                openCallback (vue) {//打开之前
                    //console.log('打开之前',vue)
                },
                closeCallback (vue) {//关闭了打印工具
                    //console.log('关闭了打印工具')
                },
            },
            printStyleElement: null, // 用于存储动态添加的<style>元素
            modalTitle: '预算申报-打印',
            visible: false,
            yuSuanList: {
                jcList: [],
                ktList: [],
                ysList: [],
                pxList: []
            },
            yuSuanTableData: [],
            jiXiaoList: [],
            jiXiaoTableData: [],
            isCaiWu: false,
            amountData: [],
            onlyPrint: false,
            formData: {},
            qmList: [],
        }
    },
    methods: {
        // 是否财务，val1:预算的四个数组，val2:绩效，val3:预算table,val4:绩效table,val5:合计数据，
        getData(isCw,value,isonle){
            this.addPrintStyles()
            this.isCaiWu = isCw
            this.onlyPrint = isonle
            this.yuSuanList = value.val1?value.val1:{jcList:[],ktList:[],ysList:[],pxList:[]}
            this.jiXiaoList = value.val2?value.val2:[]
            this.yuSuanTableData = value.val3?value.val3:[]
            this.jiXiaoTableData = value.val4?value.val4:[]
            this.amountData = value.val5?value.val5:[]
            this.visible = true
            // //console.log('*********',isCw,value,isonle)
            if(this.isCaiWu && this.yuSuanTableData){
                this.formData = this.yuSuanTableData.yssblc
                this.formData.fysldbzshr = this.formData.fysldbzshr?this.formData.fysldbzshr.split('@@'):[]
                this.formData.fysldbzshrid = this.formData.fysldbzshrid?this.formData.fysldbzshrid.split('@@'):[]
                this.formData.fysldbzshyj = this.formData.fysldbzshyj?this.formData.fysldbzshyj.split('@@'):[]
                this.formData.fysldbzshyjsj = this.formData.fysldbzshyjsj?this.formData.fysldbzshyjsj.split('@@'):[]

                this.formData.fesldbzshr = this.formData.fesldbzshr?this.formData.fesldbzshr.split('@@'):[]
                this.formData.fesldbzshrid = this.formData.fesldbzshrid?this.formData.fesldbzshrid.split('@@'):[]
                this.formData.fesldbzshyj = this.formData.fesldbzshyj?this.formData.fesldbzshyj.split('@@'):[]
                this.formData.fesldbzshyjsj = this.formData.fesldbzshyjsj?this.formData.fesldbzshyjsj.split('@@'):[]
                // //console.log('所有的id===========',[...this.formData.fysldbzshrid,...this.formData.fesldbzshrid])
                this.getQmImg([...this.formData.fysldbzshrid,...this.formData.fesldbzshrid])
            }
        },
        totalListLength(Item){
            // //console.log('************',Item.reduce((total, item) => total + item.list.length, 0))
            return Item.reduce((total, item) => total + item.list.length, 0);
        },
        getAmountData(jclx,Item,type,childType){
            if(this.amountData.length == 4){
                const itemArrA = this.amountData.filter(item => item.jclx == jclx)
                const itemArr = itemArrA[0].list.filter(item => item.name == Item)
                if(childType){
                    var itemArr1 = itemArr[0].list.filter(item => item.name == childType)
                    return itemArr1[0][type]
                }
                if(!itemArr[0][type]){
                    return 0
                }
                return itemArr[0][type]
            }
        },
        closeVisible(){
            this.visible = false
            this.removePrintStyles()
        },
        addPrintStyles() {
            // 创建并添加包含@page规则的<style>元素
            this.printStyleElement = document.createElement('style');
            this.printStyleElement.type = 'text/css';
            this.printStyleElement.media = 'print';
            this.printStyleElement.innerHTML = `
                @page {
                    margin-top: 0in;
                    margin-right: 0.5in;
                    margin-bottom: 0.5in;
                    margin-left: 0.5in;
                /* 其他打印样式 */
                }
            `;
            document.head.appendChild(this.printStyleElement);
            //console.log('打印@page',this.printStyleElement)
        },
        removePrintStyles() {
            // 确保printStyleElement存在且已被添加到DOM中
            if (this.printStyleElement && this.printStyleElement.parentNode) {
                this.printStyleElement.parentNode.removeChild(this.printStyleElement);
                this.printStyleElement = null; // 清除引用
            }
        },
        getYuSuanTableData(type){
            let Items = this.yuSuanTableData.fjob
            let tableData = []
            if(Items.length){
                tableData = Items.filter(item => item.fhjmc == type)
                if(tableData.length){
                    return tableData[0]
                }
            }
            return {
                fblyj: '',
                fqm: null,
                fblr: '',
                fblsj: ''
            }
        },
        getQmImg(val){
            this.qmList = []
            if(val.length){
                val.forEach(async (element,index) => {
                    // //console.log('执行了一次',index)
                    let resa = await getMoreUserSignLinkList({ids: element})
                    if(resa.result.length && resa.result[0].signLink !== ''){
                        this.qmList.push({
                            id: element,
                            img: resa.result[0].signLink
                        })
                    } else {
                        this.qmList.push({
                            id: element,
                            img: null
                        })
                    }
                });
            }
        },
        returnQmImg(ids){
            if(this.qmList.length){
                // //console.log('77777777777',this.qmList.filter(item => item.id == ids))
                let Item = []
                Item = this.qmList.filter(item => item.id == ids)
                if(Item.length){
                    //console.log('77777777777',Item[0].img)
                    return Item[0].img
                }
            }
        }
    },
}
</script>
<style lang="less">
.budgetDeclaration-toExamine-modal {
    .ant-modal {
        top: 50px !important;
    }
    .ant-modal-body {
        height: calc(100vh - 200px);
        overflow-y: auto;
    }
}
#budgetDeclaration-totalPrint {
    .table-Lu {
        margin-top: 1mm;
    }
    .budgetDeclaration-yuSuanList {
        padding-top: 20px;
        .table-Lu{
            // width: 794px;
            margin: 0 auto;
            // margin-top: 4mm;
            font-size: 16px;
            table-layout: fixed;
            th {
                font-family: 'SimSun', serif;
                text-align: center;
                font-size: 18px;
                font-weight: bold !important;
                line-height: 2.5;
                padding: 0px;
                color: black;
            }
            td {
                font-family: 'SimSun', serif;
                font-weight: unset;
                min-width: 150px;
                text-align: center;
                line-height: 1.5;
                padding: 0px;
                font-size: 18px;
                min-height: 46px !important;
                height: 46px;
                color: black;
                word-wrap:break-word;
                word-break:break-all;
                white-space:normal;
                .ant-form-item {
                    margin-bottom: 0px;
                }
            }
            .text-left-style {
                text-align: left;
                padding: 2px 10px;
            }
            .text-align-left {
                text-align: left;
            }
            .yjqm-right-bottom {
                text-align: right;
                .yjqmImg {
                    width: 100px !important;
                    height: 30px !important;
                    margin-right: 20px;
                }
            }
            .td-fblyj {
                padding: 0px 5px;
            }
        }
        .text-style {
            font-family: 'SimSun', serif;
            font-size: 18px;
            color: black;
        }
    }
}
</style>
